package com.attendance.chdingtask.controller;

import com.alibaba.fastjson.JSONObject;
import com.attendance.chdingtask.config.WebLog;
import com.attendance.chdingtask.service.DingWorkFlowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@Api(value = "callback", description = "回调事件接口", consumes = "application/json;charset=UTF-8")
@RequestMapping("/sccallback")
public class ReviewController extends BaseController{

    @Autowired
    private DingWorkFlowService dingWorkFlowService;


    @RequestMapping(value="/reciveInstanceCallback", method=RequestMethod.POST)
    @ResponseBody
    public Map<String, String> callback(@RequestParam(value="signature", required=false) String signature,
                                        @RequestParam(value="timestamp", required=false) String timestamp,
                                        @RequestParam(value="nonce", required=false) String nonce,
                                        @RequestBody(required=false) JSONObject json) {
//        return this.dingWorkFlowService.receiveCallback(signature, timestamp, nonce, json);
        return null;
    }



    @RequestMapping(value = "/updateUserInfo",method=RequestMethod.GET)
    @WebLog(description = "初始化人员")
    @ApiOperation(value = "初始化人员", notes = "{}")
    public void updateUserInfo(@RequestParam(value="deptId", required=false) String deptId) throws Exception {
        dingWorkFlowService.startUpdateUserInfo(deptId);
    }







//    @RequestMapping(value = "/getReviewUrl",method=RequestMethod.GET)
//    @WebLog(description = "获取回调url")
//    @ApiOperation(value = "获取回调url", notes = "{}")
//    public String getReviewUrl() throws Exception {
//        return dingWorkFlowService.getReviewUrl();
//    }
//
//    @RequestMapping(value = "/updateReviewUrl",method=RequestMethod.GET)
//    @WebLog(description = "更新回调事件")
//    @ApiOperation(value = "更新回调事件", notes = "{}")
//    public Result updateReviewUrl(@RequestParam String url) throws Exception {
//        return dingWorkFlowService.updateReviewUrl(url);
//    }


}
